package org.huangrui.javase.collectionMap.collection;

import org.junit.Test;

import java.util.ArrayList;

/**
 * @Author hr
 * @Create 2025-11-07 13:47
 **/
public class T01ArrayList {
    @Test
    public void test1(){
        ArrayList<Integer> list = new ArrayList<>();
        for(int i = 1; i<= 10; i++){
            list.add(i);
        }
        list.add(11);
    }

    @Test
    public void test2(){
        ArrayList<Integer> list = new ArrayList<>(5);//手动指定初始化容量
        for(int i = 1; i<= 5; i++){
            list.add(i);
        }
        list.add(11);
    }
}
